package com.freewater.springboot.demo.aop.advice.around;

public class PersonService {

    /**
     * 新增人员
     */
    public Person addPerson(Person person) {
        System.out.printf("person added：%s%n", person);
        return person;
    }

    /**
     * 新增人员
     */
    public Person addPerson(String name, int age) {
        if (name == null) {
            throw new NullPointerException("name can not be null");
        }
        if (age < 0) {
            throw new NullPointerException("age can not be negative");
        }
        Person person = new Person();
        person.setName(name);
        person.setAge(age);
        System.out.printf("person added：%s%n", person);
        return person;
    }
}
